package com.gp.auth;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.gp.mapper.BasePermissionMapper;
import com.gp.mapper.BaseUserMapper;
import com.gp.model.entity.BaseUser;

/**
 * @author: 弓成龙
 * @date : 2017年11月26日
 * @email : gcx909109@sina.cn
 * @description: 默认从数据库中查找对应的认证信息
 */
@Component
public class DefaultDataBaseProviderManager implements ProviderManager {

	@Autowired
	private BaseUserMapper userMapper;
	@Autowired
	private BasePermissionMapper permissionMapper;

	// 获取用户身份认证信息
	public Object getAuthenticationUserInfo(AuthCredential credential) {
		BaseUser user = new BaseUser(credential.getAuthenticationUsername(), credential.getAuthenticationPassword(),credential.getAuthenticationUserType());
		return userMapper.selectOne(user);
	}

	public List<String> getAuthorizationUserInfo(BaseUser user) {
		permissionMapper.selectUrlByUserID(user.getId());
		return null;
	}
}
